#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSUInteger, ReqMethod) {
    ReqMethodGet = 0,
    ReqMethodPost,
    ReqMethodUpload,
    ReqMethodPut,
    ReqMethodDelete
};

@class MNUploadFile, MNRemoteFile;

@interface MNBaseReq : NSObject
@property (nonatomic, assign) BOOL noEncrypt;    //是否不加密

@property (nonatomic, assign) BOOL isSB;    //是否根据message判断接口成功与失败

// 路径参数 （评接在reqUrl后面的）
@property (nonatomic, copy) NSString *routingParam;


#pragma mark- 辅助属性
/// 是否添加token
@property (nonatomic, assign) BOOL addToken;
// 参数，会同步添加到请求参数中
@property (nonatomic, strong) id paramsObject;
// 本次请求的dataTask
@property (nonatomic, weak) NSURLSessionDataTask *dataTask;
// 请求的完整url，eg. https://...
@property (nonatomic, copy) NSString *reqUrl;
// 返回的class 默认遵循命名规范，优先使用设置的class,找不到则返回BaseRsp
@property (nonatomic, strong) Class rspClass;
// 路由路径 最终会拼接到baseUrl之后, 如设置reqUrl则优先使用reqUrl
@property (nonatomic, copy) NSString *routingPath;
// 附加请求头参数，在请求结束会从sessionManager移除
@property (nonatomic, strong) NSMutableDictionary *httpHeaders;
// 请求超时时间 0-使用默认
@property (nonatomic, assign) NSTimeInterval timeoutInterval;
// 请求方式
@property (nonatomic, assign) ReqMethod method;
// 要上传的文件
@property (nonatomic, strong) NSMutableArray<MNUploadFile *> *files;
// eg.@"GET"
@property (nonatomic, strong, readonly) NSString *methodString;
// 请求标识符
@property (nonatomic, assign, readonly) NSUInteger identifier;
// 阻塞所有请求进程，直到本次请求完成,默认 NO
@property (nonatomic, assign) BOOL waitUntilDone;
// 开始请求时间
@property (nonatomic, strong) NSDate *mn_startDate;

@end

@interface MNUploadFile : NSObject
@property (nonatomic, strong) NSData *data;     //文件二进制数据
@property (nonatomic, copy) NSString *name;     //文件 标识名称
@property (nonatomic, copy) NSString *mimeType; //文件类型 如jpg
@property (nonatomic, copy) NSString *fileName; //文件名称

@property (nonatomic, strong) MNRemoteFile *remote;

@end

@interface MNRemoteFile : NSObject
@property (nonatomic, copy) NSString *fileName;
@property (nonatomic, copy) NSString *fileUrl;

@end

NS_ASSUME_NONNULL_END
